/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.merak.core.model;

import java.io.Serializable;

public class IdentifiedNamed<T extends Serializable & Comparable<T>>
     extends Identified<T>
  implements Nameable
{
	//~ Attributes ////////////////////////////////////////////////////////////////
	//*****************************************************************************
	private String name;

	//~ Constructors //////////////////////////////////////////////////////////////
	//*****************************************************************************
	protected IdentifiedNamed(T id,String name) {
		super(id);
		this.name = name;
	}

	//~ Methods ///////////////////////////////////////////////////////////////////
	//*****************************************************************************
	@Override
	public String getName() {
		return this.name;
	}
	//*****************************************************************************
	protected void setName(String name) {
		this.name = name;
	}
	//*****************************************************************************
	@Override
	public boolean hasName(String value) {
		return this.name.equals(value);
	}
	//*****************************************************************************
	@Override
	public boolean selfnamed(Nameable object) {
		return this.name.equals(object.getName());
	}
	//*****************************************************************************
	@Override
	public boolean equals(Object object) {
		return super.equals(object) && this.name.equals(((Nameable)object).getName());
	}
	//*****************************************************************************

}